{% extends 'base.html' %}

{% block js %}
<script>
    function submit_reply() {
        content = $('#content_container').val()

        $.post('/bottle/reply', {'content': content, 'bottle_id': '{{ bottle.id }}'}, function (data) {
            if(data.success){
                window.location.reload()
                $('#content_container').val('')
            }
        })
    }
</script>

<script>
    function fresh_page(){
        window.location.reload();
    }
    setTimeout('fresh_page()',3500); //指定1秒刷新一次
</script>
{% endblock %}

{% block content %}
<div class="center_div">
    {% if bottle.is_del %}
        <a style="color: #cc0000">[已删除]</a>
    {% else%}
        {% if bottle.bottlegettrace.is_del %}
            <a style="color: #cc0000">[已删除]</a>
        {% endif %}
    {% endif %}

    {{ bottle.content }}
    <br>
    <a style="font-size: small">{{ bottle.sender.userprofile.user_position_simple }}网友&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ bottle.create_time|date:'Y-m-d H:i' }}</a>
    <br><br>
    {% for r in replys %}
    {% if z_user == r.user %}<a style="color: #00AA88">●</a>{% else %}<a style="color: #ffdddd">●</a>{% endif %}
    &nbsp;&nbsp;<a style="font-size: smaller">{{ r.create_time|date:'Y-m-d H:i' }}</a><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ r.content }}<br>
    {% endfor %}
    <br>
    <!--<button style="background-color: #ff6666; text-align: center; width: 50%" onclick="window.location.reload()">-->
        <!--获取对方回复-->
    <!--</button>-->
    <br><br>
    <textarea id="content_container" placeholder="回复..." style="width: 50%"></textarea>
    <br>
    <button onclick="submit_reply()">提交</button>
</div>

{% endblock %}